package com.ifonly.activerecord;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Map;

/**
 * @author <a href="mailto:ifonlymaster@163.com">ifonly</a>
 * @version 1.0 2015-12-17 16:03
 * @since JDK 1.6
 */
public class Table implements Serializable {
    private static final long serialVersionUID = -498174075651377667L;

    private String[] primaryKeys;
    private String tableName;
    private Class<? extends Model> model;
    private Map<String, Class<?>> columnAndTypes;

    public Table(String tableName, Class<? extends Model> model) {
        this.tableName = tableName;
        this.model = model;
    }

    public String[] getPrimaryKeys() {
        return primaryKeys;
    }

    public void setPrimaryKeys(String[] primaryKeys) {
        this.primaryKeys = primaryKeys;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public Class<? extends Model> getModel() {
        return model;
    }

    public void setModel(Class<? extends Model> model) {
        this.model = model;
    }

    public Map<String, Class<?>> getColumnAndTypes() {
        return columnAndTypes;
    }

    public void setColumnAndTypes(Map<String, Class<?>> columnAndTypes) {
        this.columnAndTypes = columnAndTypes;
    }

    @Override
    public String toString() {
        return "Table{" +
                "primaryKeys=" + Arrays.toString(primaryKeys) +
                ", tableName='" + tableName + '\'' +
                ", model=" + model +
                ", columnAndTypes=" + columnAndTypes +
                '}';
    }
}
